<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>FATEC-ZL Glossario Comex</title>
<link rel="stylesheet" href="css/reset.css" type="text/css" media="all">
<link rel="stylesheet" href="css/layout.css" type="text/css" media="all">
<link rel="stylesheet" href="css/style.css" type="text/css" media="all">
<script type="text/javascript" src="js/maxheight.js"></script>
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/cufon-yui.js"></script>
<script type="text/javascript" src="js/cufon-replace.js"></script>
<script type="text/javascript" src="js/Myriad_Pro_300.font.js"></script>
<script type="text/javascript" src="js/Myriad_Pro_400.font.js"></script>
<script type="text/javascript" src="js/jquery.faded.js"></script>
<script type="text/javascript" src="js/jquery.jqtransform.js"></script>
<script type="text/javascript">
	$(function() {
		$("#faded").faded({
			speed : 500,
			crossfade : true,
			autoplay : 10000,
			autopagination : false
		});
		$('#domain-form').jqTransform({
			imgPath : 'images/'
		});
	});
</script>
<!--[if lt IE 7]><script type="text/javascript" src="js/ie6_script_other.js"></script><![endif]-->
<!--[if lt IE 9]><script type="text/javascript" src="js/html5.js"></script><![endif]-->
<script type="text/javascript">
	function limitaTextarea(valor) {
		quantidade = 1000;
		total = valor.length;
		if (total <= quantidade) {
			resto = quantidade - total;
			document.getElementById('contador').innerHTML = resto;
		} else {
			document.getElementById('texto').value = valor
					.substr(0, quantidade);
		}
	}
</script>
<script type="text/javascript">
	function limitaTextarea1(valor) {
		quantidade = 1000;
		total = valor.length;
		if (total <= quantidade) {
			resto = quantidade - total;
			document.getElementById('contador1').innerHTML = resto;
		} else {
			document.getElementById('textooriginal').value = valor.substr(0,
					quantidade);
		}
	}
</script>
</head>
<c:if test="${requestScope.login ne null}">
	<body id="page1" onLoad="new ElementMaxHeight();">
		<!-- START PAGE SOURCE -->
		<div class="tail-top">
			<header> <br />
			<div class="container">
				<div class="header-box">
					<div class="left">
						<div class="right">

							<h1>
								<a href="index.jsp"><span>COMEX</span> FATEC ZL</a>
								<a href="index.jsp"><img src="./fig/sair.png" ></a>
							</h1>
						</div>
					</div>
				</div>
				<span class="top-info"></span>
				<form action="login" method="post" id="login-form">
					<fieldset></fieldset>
				</form>
			</div>
			</header>

			<section id="content">
			<div class="container">

				<div class="inside1">
					<div class="wrap row-2">
						<form action="gravar" method="post">
							<article class="col-1">
							<table>
								<tr>
									<td>RA</td>
									<td colspan="3"><input type="text" size="10" name="ra"
										readonly="readonly" value="${requestScope.login.senha}" /></td>
								</tr>
<!--  
								<tr>
									<td>Nome</td>
									<td colspan="3"><input type="text" size="50" name="nome"
										readonly="readonly" value="${requestScope.login.nomeCompleto}" /></td>
								</tr>
-->
								<tr>
									<td>Termo</td>
									<td><input type="text" size="50" name="termo" /></td>
									<td>Termo Original</td>
									<td><input type="text" size="50" name="termooriginal" /></td>
								</tr>
								<tr>
									<td>Texto</td>
									<td><textarea cols="50" rows="10" style="resize: none"
											onkeyup="limitaTextarea(this.value)" name="texto"></textarea>
										<br /> Campo (caracteres restantes: <span id="contador">1000</span>)</td>
									<td>Texto Original</td>
									<td><textarea cols="50" rows="10" style="resize: none"
											onkeyup="limitaTextarea1(this.value)" name="textooriginal"></textarea>
										<br /> Campo (caracteres restantes: <span id="contador1">1000</span>)</td>
								</tr>
								<tr>
									<td>Fonte:</td>
									<td colspan="3"><input type="text" size="115" name="fonte" /></td>
								</tr>
								<tr align="center">
									<td colspan="4"><input type="submit" name="enviar"
										value="Enviar"></td>
								</tr>
								<c:if test="${requestScope.erro ne null}">
									<c:out value="${requestScope.erro}"></c:out>
								</c:if>
								<c:if test="${requestScope.mensagem ne null}">
									<c:out value="${requestScope.mensagem}"></c:out>
								</c:if>
							</table>
							</article>
							<div class="clear"><br /></div>
							<div class="container">
								<div class="inside">
									<table>
										<tr>
											<td colspan="6" align="center">Lista de Termos
												Cadastrados</td>
										</tr>
										<tr>
											<td>Termo</td>
											<td style="white-space: normal;max-width: 20px">Significado</td>
											<td>Termo Original</td>
											<td>Significado Original</td>
											<td>Fonte</td>
											<td>Excluir</td>
										</tr>
										<c:forEach var="item"
											items="${requestScope.termosCadastrados}">
											<tr>
												<td style="white-space: normal;max-width: 50px;word-wrap: break-word;"><c:out value="${item.nomeTermo}" /></td>
												<td style="white-space: normal;max-width: 250px;word-wrap: break-word;"><c:out value="${item.termo}" /></td>
												<td style="white-space: normal;max-width: 50px;word-wrap: break-word;"><c:out value="${item.nomeTermoOriginal}" /></td>
												<td style="white-space: normal;max-width: 250px;word-wrap: break-word;"><c:out value="${item.termoOriginal}" /></td>
												<td style="white-space: normal;max-width: 120px;word-wrap: break-word;"><c:out value="${item.fonte}" /></td>
												<td align="center"><a
													href="gravar?param1=${item.idTermo}&param2=${requestScope.login.nomeCompleto}&param3=${requestScope.login.senha}"><img
														src="fig/lixo.png"></a></td>
											</tr>
										</c:forEach>
									</table>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
		</section>
	</body>
</c:if>
</html>